package com.util
{
	public class Point3D
	{
		public function Point3D(x:Number, y:Number, z:Number)
		{
			this.x = x;
			this.y = y;
			this.z = z;
		}
		
		public var x:Number;
		public var y:Number;
		public var z:Number;
		
		public function clone():Point3D
		{
			return new Point3D(this.x, this.y, this.z);
		}
		
		public function distance(p:Point3D):Number
		{
			return Math.sqrt((p.x - x) * (p.x - x) +
				(p.y - y) * (p.y - y) + 
				(p.z - z) * (p.z - z));
		}
		
		public function step(tarP:Point3D, speed:Number):void {
			var xAng:Number = (tarP.x - x) / distance(tarP);
			var yAng:Number = (tarP.y - y) / distance(tarP);
			var zAng:Number = (tarP.z - z) / distance(tarP);
			this.x += speed * xAng;
			this.y += speed * yAng;
			this.z += speed * zAng;
		}
	}
}